//
//  YPMyInvestViewController.m
//  ChengHuiTong
//
//  Created by CHT-Technology on 2017/3/2.
//  Copyright © 2017年 张文权. All rights reserved.
//

#import "YPMyInvestViewController.h"
#import "DQDScrollContentView.h"
#import "YPMyInvestItemView.h"
#import "YPInvestDetailViewController.h"

@interface YPMyInvestViewController ()<DQDScrollContentViewDataSource>{
    
    NSArray *_titlesArray;
    
}
@property (nonatomic,strong)DQDScrollContentView *contentView;

@end

@implementation YPMyInvestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.navigationItem.title = @"我的投资";
    
    _titlesArray = @[@"回款中",@"投标中",@"已结束",@"已转让"];
    
    [self setUpUI];
}

- (void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.navigationController setNavigationBarHidden:NO animated:YES];
    [MobClick beginLogPageView:@"我的投资"];
}

- (void) viewWillDisappear:(BOOL)animated{
    [super viewWillDisappear:animated];
    [MobClick endLogPageView:@"我的投资"];
    
}

- (void)setUpUI{
    
    _contentView = [[DQDScrollContentView alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - 64) topScrollEnabled:NO showTopScrollLine:NO];
    _contentView.dataSource = self;
    [self.view addSubview:_contentView];
}

#pragma mark --DQDScrollContentViewDataSource
- (NSArray *)homeViewWithTitleArray{
    
    return _titlesArray;
}

- (DQDScrollContentItemView *)homeViewItemWithContentViewWithIndex:(NSInteger)index{
    
    YPMyInvestItemView *contentItemView = [[YPMyInvestItemView alloc]initWithFrame:CGRectZero style:UITableViewStylePlain];

    WeakSelf
    contentItemView.cellClickBlock = ^(YPMyInvestModel *model){
        
        YPInvestDetailViewController * investDetailVC = [[YPInvestDetailViewController alloc]init];
        YPInvestModel *investmodel = [[YPInvestModel alloc]init];
        investmodel.bid = model.borrow_id;
        investmodel.title = model.title;
        investDetailVC.investModel = investmodel;
        [weakSelf.navigationController pushViewController:investDetailVC animated:YES];
    };
    return contentItemView;
   
}


@end
